package com.by.controller;

import com.by.core.bean.ResultBean;
import com.by.core.controller.BaseController;
import com.by.entity.Member;
import com.by.mapper.MemberAddressMapper;
import com.by.mapper.MemberMapper;
import com.by.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.crypto.Data;


@RestController
@Api(tags = "会员管理")
@RequestMapping("/api")
public class MemberController extends BaseController {

    @Autowired
    MemberService memberService;


    @PutMapping("/register")
    @ApiOperation("注册")
    public ResultBean register(Member member){
        memberService.save(member);
        return success("注册成功");
    }


    @ApiOperation("查询")
    @GetMapping("/query")
    public ResultBean query(int id) {
        Member member = memberService.getById(id);
        return success("查询成功", member);
    }

}
